package com.enjoyor.soa.traffic.server.tsms.helper;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.enjoyor.soa.traffic.api.dto.gps.PositionDto;
import com.enjoyor.soa.traffic.api.service.dubbo.gps.PositionListener;
import com.enjoyor.soa.traffic.server.tsms.handler.ReceiveHandler;

public class PositionListenerImpl implements PositionListener {
	
	// 全局变量
	private static PositionListenerImpl positionListener= null;
	public PositionListenerImpl (){ }
	/**
	 * 实体对象
	 * @return
	 */
	public static PositionListenerImpl getInstance() {						
			if (positionListener == null) {
				positionListener = new PositionListenerImpl() ;			 
			}
			return positionListener;
		}
	@Override
	public void locate(PositionDto position) {
		try {
			ReceiveHandler.getInstance().handle(position);
		/*	for(int i=0;i<this.threadList.size();i++){
				if(	threadList.get(i).getPositionDeviceId().equals(position.getLocid())){
					double[] geo=new double[]{position.getLongitude(),position.getLatitude()};
					//System.out.println("收到坐标"+position.getLongitude()+"_"+position.getLatitude());
					threadList.get(i).setGeo(geo);
					threadList.get(i).setSpeed(position.getSpeed());
					threadList.get(i).setReceiveTime(new Date());
					threadList.get(i).setUpdateTime(position.getUpdateTime());
				}
			}*/

		} catch (Exception e) { 
			//logger.error("转换定位对象或保存定位异常，详细：" + e.getMessage());
		}	
		
	}

}
